package com.example.demo.common;

public class ThreadLocalUtil {

    //全局的ThreadLocal
    private final static ThreadLocal THREAD_LOCAL = new ThreadLocal();

    //存储数据
    public static String set(Object obj) {
        THREAD_LOCAL.set(obj);
        return obj.toString();
    }

    //读取数据
    public static Object get() {
        return THREAD_LOCAL.get();
    }

    //注销数据,避免内容泄露
    public static void remove() {
        THREAD_LOCAL.remove();

    }


}
